/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.admin;

import java.io.Serializable;


/**
 * JBFieldDescriptor which does not check the type.
 *
 */
public class JBFieldDescriptor
    extends opiam.admin.faare.config.javabeans.JBFieldDescriptor
    implements Serializable
{
    /** Type of field : string. */
    private static final String SHORT_STRING_TYPE = "string";

    /** Type of field : bytes. */
    private static final String SHORT_BYTES_TYPE = "bytes";

    /** Type of field : bytes, object format. */
    private static final String FULL_BYTES_TYPE = "java.lang.Byte";

    /** Type of field : string, object format. */
    private static final String FULL_STRING_TYPE = "java.lang.String";

    /** Type of field : int. */
    private static final String SHORT_INTEGER_TYPE = "integer";

    /** Type of field : int, object format. */
    private static final String FULL_INTEGER_TYPE = "java.lang.Integer";

    /** Field Java type. */
    private String type;

    /**
     * Returns the type.
     * @return String
     */
    @Override
	public String getType()
    {
        return type;
    }

    /**
     * Sets the type.
     * @param atype The type to set
     */
    @Override
	public void setType(String atype)
    {
        if (atype.compareToIgnoreCase(SHORT_STRING_TYPE) == 0)
        {
            this.type = FULL_STRING_TYPE;
        }
        else if (atype.compareToIgnoreCase(SHORT_INTEGER_TYPE) == 0)
        {
            this.type = FULL_INTEGER_TYPE;
        }
        else if (atype.compareToIgnoreCase(SHORT_BYTES_TYPE) == 0)
        {
            this.type = FULL_BYTES_TYPE;
        }
        else
        {
            this.type = atype;
        }
    }
}
